#!/bin/bash
# 检查 Apache 服务状态并重启
SERVICE_NAME="httpd"

if systemctl is-active --quiet $SERVICE_NAME; then
    echo "$SERVICE_NAME is running..."
else
    echo "$SERVICE_NAME is not running. Starting $SERVICE_NAME..."
    systemctl start $SERVICE_NAME
fi

# 重启服务
echo "Restarting $SERVICE_NAME..."
systemctl restart $SERVICE_NAME
echo "$SERVICE_NAME has been restarted."